/* Global Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --error-color: #f44336;
    --error-dark: #d32f2f;
    --text-color: #2c3e50;
    --text-light: #f8f9fa;
    --border-color: #ddd;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 18px;
    --radius-full: 9999px;
}

/* Base HTML Elements */
html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-light);
}

button,
input,
textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

button {
    cursor: pointer;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.full-width {
    width: 100%;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-4 {
    padding: 1rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.rounded {
    border-radius: var(--radius-sm);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.bg-white {
    background-color: var(--bg-white);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Form Elements */
.input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease;
}

.input:focus {
    border-color: var(--primary-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-error {
    background-color: var(--error-color);
    color: white;
}

.btn-error:hover {
    background-color: var(--error-dark);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fff1f0;
    border: 1px solid #ffccc7;
    color: var(--error-color);
}

/* Loading Indicators */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.typing-indicator {
    display: flex;
    padding: 0.5rem 1rem;
    background-color: #f1f1f1;
    border-radius: var(--radius-lg);
}

.typing-indicator span {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin: 0 0.125rem;
    background-color: #999;
    border-radius: var(--radius-full);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-0.25rem);
    }
    50% {
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
}